<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
    <title>Document</title>

</head>
<body>
    <div id="app">
        <button @click="handler">修改数组数据</button>
        <ul>
            <li v-for="(value,key )in person" :key="item">{{key}}--{{value}}</li>
        </ul>

    </div>
    <script>

        Vue.config.productionTip = false

        const vm = new Vue({
            el:'#app',
            data(){
                return{
                    person: {
                        name: "laowang",
                        age: 18,
                        score: {
                            math: 100,
                            ch: 90,
                        },
                    },
                }
            },
            methods:{
                handler(){
                    // this.person.name = 'laowang';
                    // this.person.score.math = 120
                    //
                    // this.person={...this.person, age:30}
                    //
                    // this.person.sex = '男'
                    //
                    // this.$set(this.person, 'sex', '男')
                    // Vue.set(this.person, 'sex', '男')
                    //
                    // delete this.person.age
                    //
                    // this.$delete(this.person,'age')
                    // Vue.delete(this.person,'age')

                    delete this.person.age
                    this.person = {...this.person}
                }
            }
        })
    </script>
</body>
</html>